<%@ page import="zut.DAO.impl.UserDAOImpl" %>
<%@ page import="zut.DO.UserDO" %>
<%@ page import="zut.DO.ResultDO" %>
<%@ page import="java.util.List" %>
<%@ page import="zut.DO.AuctionDO" %>
<%@ page import="zut.DAO.impl.AuctionDAOImpl" %><%--
  Created by IntelliJ IDEA.
  User: Glory
  Date: 2020-11-12 0012
  Time: 16:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品列表</title>
</head>
<body>
<%
    UserDAOImpl udl = new UserDAOImpl();
    ResultDO<UserDO> r = (ResultDO<UserDO>) request.getSession().getAttribute("user");
    String userid = (String) request.getSession().getAttribute("userid");
    UserDO user = udl.getUserDO(userid);
    List<AuctionDO> list = new AuctionDAOImpl().getall();
    if(user==null){
        %>
< color="red">
    <%= r.getInfo()%>>
</>
    <a href="login.html">重新登录</a>
<table border="1">
    <tr>
        <th>商品序号</th>
        <th>商品名称</th>
        <th>商品价格</th>
        <th>商品详情</th>
    </tr>
    <%
        for (int i = 0; i < list.size(); i++){
    %>
    <tr align="center">
        <form action="ShopCardController?type=addCard&id="<%= i %> method='post'>
        <td> <%= list.get(i).getId() %></td>
        <td> <%= list.get(i).getName() %></td>
        <td> <%= list.get(i).getPrice() %></td>
        <td> <%= list.get(i).getDetail() %></td>
<%--        <td><a href="<%=pageContext.getServletContext().getContextPath()%>/web/AddCartServlet?id=<%= list.get(i).getId() %>">加入购物车</a></td>--%>
        </form>
    </tr>
    <%
        }
    }
    %>
</table>
</body>
</html>